<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/main.min.css" rel="stylesheet" type="text/css"/>
</block>
<?php
    $cover_path=getThumbImageById($content['goods_img']);
?>
<block name="body">
    <include file="_nav"/>
    <div id="main-container" class="container">
        <div class="scoreshop">
            <div class="common_block_border ">
                <div class="col-xs-9 goods_detail">
                    <div class="row">
                        <div class="title_content">{:L('_MALL_')}&nbsp;/&nbsp;
                            <a href="{:U('goods',array('category_id'=>$top_category))}">{$category_name}</a>
                            <if condition="$child_category_name neq '' && $child_category_name neq null">
                                &nbsp;/&nbsp;
                                <a href="{:U('goods',array('category_id'=>$category_id))}">{$child_category_name}</a>
                            </if>&nbsp;->&nbsp;
                            <a href="{:U('goodsDetail',array('id'=>$content['id']))}">{$content.goods_name}</a>
                        </div>
                        <div class="col-xs-6">
                            <img class="img-responsive" src="{$content.goods_img|getThumbImageById=359,359}"/>
                        </div>
                        <div class="col-xs-6">
                            <h3 class="text-more mb_34">
                                <font title="{$content.goods_name}">{$content.goods_name}</font>
                            </h3>
                            <div class="text-more mb_34 intro">
                            <span>
                                <font title="{$content.goods_introduct}">
                                    {$content.goods_introduct}
                                </font>
                            </span>
                            </div>
                            <div class="price clearfix mb_34">
                                <if condition="is_login() neq 0">
                                    <font title="{:L('_MY_')}{$money_type.title}：{$my_money} {$money_type.unit}">
                                        <span class="item">{:L('_NEED_')}{$money_type.title}：
                                            <aq>
                                                <span class="now-price">{$content.price}</span> {$money_type.unit}
                                            </aq>
                                        </span>
                                    </font>
                                    <else/>
                                    <span class="item">{:L('_NEED_')}{$money_type.title}：<aq>{$content.price} {$money_type.unit}</aq></span>
                                </if>
                                <span class="item quantity">{:L('_STOCK_')}{:L('_COLON_')}<aq>{$content.quantity}</aq></span>
                            </div>
                            
                            <div class="sku_table clearfix">
                            <php>
                            /*有规格，在规格里选择数量*/
                            if(!empty($content['sku_table'])){
                            </php>
                                <section class="sku-content" data-id="{$goods.id}">
                                    <php>
                                    foreach($content['sku_table']['table'] as $in => $table){
                                    </php>
                                        <dl class="sku-box clearfix">
                                            <dt><php> echo $in </php></dt>
                                            <dd>
                                            <ul data-sku="<php> echo $in </php>">
                                                <php>foreach($table as $t){</php>
                                                    <li class="" data-table="<php> echo $in </php>" data-value="<php> echo $t </php>"><php> echo $t </php><i></i></li>
                                                <php>}</php>
                                            </ul>
                                            </dd>
                                        </dl>
                                    <php>
                                    }
                                    </php>
                                    <input type="hidden" >
                                </section>
                            <php>}</php>
                            </div>

                            <div class="mb_34">
                                <if condition="is_login()">
                                    <a class="btn btn-warning scoreshop-btn" data-toggle="modal" data-name="buyModal" 
                                      data-remote="{:U('Scoreshop/index/goodsbuy',array('id'=>$content['id']))}" 
                                      >{:L('_EXCHANGE_')}
                                    </a>
                                  <else />
                                    <a class="btn btn-lg btn-warning scoreshop-btn" data-login="quick_do_login" data-remote="/ucenter/member/quicklogin.html" data-toggle="modal">
                                        {:L('_EXCHANGE_')}
                                    </a>
                                </if>
                            </div>
                            <div class="time_show">
                                {:L('_DELIVER_TIME_')}{:L('_COLON_')} {:date('Y-m-d',$content['createtime'])}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                {:L('_UPDATE_TIME_')}{:L('_COLON_')} {:date('Y-m-d',$content['changetime'])}
                            </div>
                        </div>
                    </div>

                    <div class="details">
                        <h3>{:L('_PRODUCT_DETAIL_')}</h3>
                        {$content.goods_detail}
                    </div>
                    
                    <div>
                        {:hook('localComment', array('path'=>"Scoreshop/goodsDetail/$content[id]", 'uid'=>$content['uid'],'this_url'=>'Scoreshop/index/goodsdetail'))}
                    </div>
                </div>
                <div class="col-xs-3 fl_left">
                    <if condition="is_login() neq 0">
                        <div class="row pad_15">
                            <h2 style="font-size: 16px;">{:L('_VIEW_RECENT_')}</h2>

                            <div class="goods_same_category clearfix">
                                <ul>
                                    <volist name="goods_see_list" id="vo">
                                        <li class="items clearfix">
                                            <dl>
                                                <dt><a href="{:U('Scoreshop/Index/goodsDetail',array('id'=>$vo['id']))}"><img
                                                        class="img-responsive" style="max-width: 120px"
                                                        src="{$vo.goods_img|getThumbImageById=135,135}"></a></dt>

                                                <dd>
                                                    <h3 class="text-more"><font
                                                            title="{$vo.goods_name|op_t}">{$vo.goods_name}</font>
                                                    </h3>

                                                    <div class="money"><font title="{:L('_NEED_')}{$money_name}"><i class="ico_to_money"></i>&nbsp;{$vo.price}</font>
                                                    </div>
                                           </dl>
                                        </li>
                                    </volist>
                                </ul>
                            </div>
                            <if condition="count($goods_see_list) eq 0">
                                <div style="font-size: 16px;padding:2em 0;color: #ccc;text-align: center">
                                    {:L('_TIP_OTHER_PRODUCT_NOT_VIEWED_')}
                                </div>
                            </if>
                        </div>
                    </if>

                    <div class="row pad_15">
                        <h2 style="font-size: 16px;">{:L('_CONTRAST_SAME_CATEGORY_')}</h2>

                        <div class="goods_same_category clearfix">
                            <ul>
                                <volist name="contents_same_category" id="vo">
                                    <li class="items clearfix">
                                        <dl>
                                            <dt><a href="{:U('Scoreshop/Index/goodsDetail',array('id'=>$vo['id']))}"><img
                                                    class="img-responsive" style="max-width: 120px"
                                                    src="{$vo.goods_img|getThumbImageById=135,135}"></a></dt>
                                            <dd>
                                                <h3 class="text-more"><font
                                                        title="{$vo.goods_name|op_t}">{$vo.goods_name}</font>
                                                </h3>

                                                <div class="money"><font title="{:L('_NEED_')}{$money_name}"><i class="ico_to_money"></i>&nbsp;{$vo.price}</font>
                                                </div>
                                            </dd>
                                        </dl>
                                    </li>
                                </volist>
                            </ul>
                        </div>
                        <if condition="count($contents_same_category) eq 0">
                            <div style="font-size: 16px;padding:2em 0;color: #ccc;text-align: center">
                                {:L('_TIP_PRODUCT_SAME_CATEGORY_NONE_')}
                            </div>
                        </if>
                    </div>
                </div>
            </div>
        </div>
    </div> 
<input type="hidden" data-toggle="goods_id" value='{$content.id}' />
<input type="hidden" data-toggle="goods_sku" value='{$content.sku_table_json}' />
</block>

<block name="script">
    <script src="__JS__/sku.js"></script>
    <script type="text/javascript">
        $(function(){
            var goods_sku = $('input[data-toggle="goods_sku"]').val();
            if(goods_sku) goods_sku = $.parseJSON(goods_sku);
            $('.sku-content').Muusku({
                sku_data:goods_sku
            });
        });

        $(function(){
            var buy_url = $('.scoreshop-btn').data('remote');
            $('.sku-box ul li').click(function(){
                var v = $('.sku-content input').val();
                var pam = '?sku='+v;
                $('.scoreshop-btn').data('remote',buy_url+pam);
            });
        });
    </script>
</block>
